class JoshphingRing:
    def __init__(self, step, death_num, start, students_list):
        self.people_num = len(students_list)
        self.step = step
        self.death_num = death_num
        self.start = start
        self.students_list = students_list
        self.index = self.start - 1
        self.death_count = 0
        self.order = [x for x in range(1, self.people_num + 1)]

    def __next__(self):
        if self.death_count < self.death_num:
            self.index = (self.step + self.index - 1) % len(self.order)
            self.death_count += 1
            death_serial_number = self.order[self.index]
            del self.order[self.index]
            return f"#{death_serial_number} {self.students_list[self.index][0]} {self.students_list[self.index][1]}"
        else:
            raise StopIteration()

    def __iter__(self):
        return self
